#pragma once
#include <vector>

struct node;
struct edge;

class Vector2;

struct node{
	bool occupied;
	bool nextToOccupied;
	bool isGoal;

	int flag;
	float cost;
	float cost2;
	float x, y;

	node* previous;

	std::vector<edge> neighbors;
};

struct edge{
	static edge newEdge(node* from, node* to, double weight){
		edge e = {weight, from, to};
		return e;
	};
	double weight;
	node * from;
	node * to;
};

class Graph
{
public:
	Graph();
	Graph(int x, int y, int w, int h);
	~Graph(void);

	bool initialize(int x, int y, int w, int h);
	bool setColumn(int col, std::string& line);

	void buildEdges();

	node* getNode(Vector2 v);

	Vector2 getTopLeft();

	void setObstacle(Vector2 v);

	void setGoal(Vector2 v);

	void clearFlags();

private:

	int width;
	int height;
	int x, y;

	std::vector<node> graph;
};

